/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author 王宇
* @date 2025-08-26
**/
@Entity
@Data
@Table(name="terms_rules")
public class TermsRules implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "自增主键")
    private Long id;

    @Column(name = "rule_code")
    @ApiModelProperty(value = "条款编号")
    private String ruleCode;

    @Column(name = "title",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "条款标题")
    private String title;

    @Column(name = "content",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "条款内容")
    private String content;

    @Column(name = "status")
    @ApiModelProperty(value = "是否生效0：无效，1：生效，-1：删除")
    private Integer status;

    @Column(name = "gmt_create")
    @ApiModelProperty(value = "创建时间")
    private Timestamp gmtCreate;

    @Column(name = "gmt_modified")
    @ApiModelProperty(value = "修改时间")
    private Timestamp gmtModified;

    @Column(name = "createby")
    @ApiModelProperty(value = "创建人")
    private String createby;

    @Column(name = "updateby")
    @ApiModelProperty(value = "修改人")
    private String updateby;

    @Column(name = "version")
    @ApiModelProperty(value = "版本号")
    private Integer version;

    @Column(name = "sort")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "type")
    @ApiModelProperty(value = "类型")
    private Integer type;

    public void copy(TermsRules source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}